package com.example.thread;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class ThreadApplication {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx =
                new AnnotationConfigApplicationContext(ThreadPoolConfig.class, TaskExecutorService.class);
        TaskExecutorService service = ctx.getBean(TaskExecutorService.class);
        service.executeTimeTask(60);
        service.executeTimeTask(5);
        try {
            Thread.sleep(60_000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        service.shutdownExecutor();
        ctx.close();
    }
}
